// Copyright (c) 2020 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

/**
*@describe:
*@author wfl19/Kristas
*@date 2021/10/30
 */

package select_mapper

import (
	"gorm.io/gorm"
)

type Any = interface{}

type SelectMapper struct {
	table string
	db    *gorm.DB
}

func NewSelectMapper(table string, db *gorm.DB) *SelectMapper {
	return &SelectMapper{table: table, db: db}
}

func (s *SelectMapper) Select(value Any) error {
	return s.db.Table(s.table).Where(value).Find(value).Error
}
